const enterpriseVue = new Vue({
  el: '#app',
  data() {
    return {
      io_form: {
        Integral_Type_SerialNumber: "",
        Integral_Type_Name: "",
        Sales_Amount: "",
        Gift_PointL: "",
        Every_Sales_Amount: "",
        Every_Gift_Point: "",
        Enterprise_Info_SerialNumber: $.cookie("enterprise"),
      },
      in_store_info: [],
      rules: {
        Sales_Amount: [
          { required: true, message: '请输入每消费金额' }
        ],
        Gift_Point: [
          { required: true, message: '请输入获得积分' }
        ],
        Every_Sales_Amount: [
          { required: true, message: '请输入消费满金额' }
        ],
        Every_Gift_Point: [
          { required: true, message: '请输入获得积分' }
        ],
        Integral_Type_Name: [
          { required: true, message: '请输入积分类型名称' }
        ]
      }
    }
  },
  methods: {
    submitForm() {
      let _this = this;
      this.$refs.contract.validate(valid => {
        if (valid) {
          $.ajax({
            url: DomainName + '/getAddAction?token=' + $.cookie("token"),
            type: 'POST',
            data: {
              Data: JSON.stringify({ integral_type: [_this.io_form] }),
            },
            success: function (res) {
              console.log(res);
            },
            complete: function (XMLHttpRequest) {
              _this.loading = false
              if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                window.parent.document.location.href = "../../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
              }
            }
          })
        } else {
          // 表单验证未通过
          console.log('表单验证未通过');
        }
      });

    },

  },
  created() {
  }
})